From 667109bab4d69b2618afec7cdea0047a782b151f Mon Sep 17 00:00:00 2001 From: oliskoli Date: Fri, 4 May 2007 08:44:42 +0000 Subject: [PATCH] g7towin: Fix reading of waypoint lines with empty (short)names. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2769 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/g7towin.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gpsbabel/g7towin.c b/gpsbabel/g7towin.c index f3e7c7e59..5c52a7751 100644 --- a/gpsbabel/g7towin.c +++ b/gpsbabel/g7towin.c @@ -272,17 +272,21 @@ parse_waypt(char *buff) if (gardown) cin = buff + 6; - else + else { + /* We've seen waypoints with length of 14 and 15 !!! */ cin = buff + 15; + while ((cin > buff) && (! isspace(*cin))) cin--; + } while (isspace(*cin)) cin--; if (cin >= buff) wpt->shortname = xstrndup(buff, cin - buff + 1); if (gardown) - buff += 7; + buff += 6; else - buff += 16; + buff += 15; + while (isspace(*buff)) buff++; buff += parse_coordinates(buff, datum, grid, &wpt->latitude, &wpt->longitude, MYNAME); @@ -438,7 +442,7 @@ data_read(void) case 'P': /* proximity waypoint */ case 'W': /* normal waypoint */ - wpt = parse_waypt(cdata); + wpt = parse_waypt(cin + 3); prev = wpt; if (wpt) { if (mode == rtedata) -- 2.30.2